<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生系统主页</title>
    <link href="bootstrap-4.6.1-dist/css/bootstrap.css"
          rel="stylesheet" type="text/css">
    <script src="jQuery/jquery-3.6.0.min.js"></script>
    <script src="bootstrap-4.6.1-dist/js/bootstrap.min.js"></script>
    <style>
        .dropdown{
            margin-bottom: -20px;
        }
        .dropdown:hover{
            margin: 0px;
        }
        .show{
            /*display: block;*/
            overflow: hidden;
            visibility: hidden;
            max-height: 0px;
            transform: scaleY(0);
        }
        .dropdown:hover .show {
            visibility: visible;
            transition: transform 0.2s;
            max-height: 999999px;
            transform: scaleY(1);
        }
        .userPortrait {
            width: 40px;
            height: 40px;
            border: 1px solid red;
            border-radius: 50%;
            overflow: hidden;
            margin: 0 auto;
            /*margin-top: 100px;*/
        }
        .userPortrait img {
            display: block;
            width: 100%;
            height:100%;
            border: 1px solid green;
        }
        .thing{
            width: 100%;
            height:640px;
        }
        .welcome{
            width: 100%;
            height: 160px;
            float: left;
        }
        /*.homework{*/
        /*    width: 100%;*/
        /*    height: 100%;*/
        /*    float: left;*/
        /*}*/
    </style>
</head>
<body>

<!--眉头-->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
    <a class="navbar-brand col-1 text-center" href="index.html">爱思教育</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse">
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link active" href="userInformation.html">查询和修改个人信息</a>
            </li>
<!--            <li class="nav-item active">-->
<!--                <a class="nav-link" href="studentSelectHomework.html">-->
<!--                    我的作业-->
<!--                </a>-->
<!--            </li>-->
            <li class="nav-item active" id="exam">
                <a class="nav-link" href="studentExaminationInformation.html">
                    我的考试
                </a>
            </li>
        </ul>
    </div>
    <div class="userPortrait active dropdown">
        <a href="userInformation.html"><img src="img/defaultPortrait.jpg" alt=""></a>
    </div>
</nav>

<!--中间-->
<div class="row">
    <!--侧边栏-->
    <ul class="navbar-nav bg-light text-center col-md-2" id="subjectList">
        <li class="nav-item" id="liUnfinished">
            <a class="nav-link btn btn-light" href="studentSelectHomework.html">未完成作业</a>
        </li>
        <li class="nav-item" id="liFinished">
            <a class="nav-link btn btn-light" href="studentFinishedHomework.html">已完成作业</a>
        </li>
    </ul>
    <div class="main col-10">
        <div class="main col-10 welcome">
            <font face="隶书" size="+4" color=black>欢迎使用爱思教务</font><br/>
            <font face="隶书" size="+3" color=black>以下是您完成的作业</font><br/>
        </div>
        <div class="main col-10 homework">

        </div>
    </div>
</div>


<!--页脚-->
<div class="bg-primary text-center">
    <p class="text-white">版权所有© Copyright 1999-2021 爱思软件股份有限公司　　中国·青岛黄岛区嘉陵江路777号 西区公寓2号   版本V-0.0.1</p>
</div>
<!--<div class="footer bg-primary fixed-bottom text-center">-->
<!--    <p class="text-white">版权所有© Copyright 1999-2021 爱思软件股份有限公司　　中国·青岛黄岛区嘉陵江路777号 西区公寓2号   版本V-0.0.1</p>-->
<!--</div>-->
</body>
<script>
    jQuery(function () {
        let loc = location.href;
        let n1 = loc.length;
        let n2 = loc.indexOf("=");
        if (n2==-1) {
            location.href="userLogin.html";
        }
        let id = decodeURI(loc.substr(n2+1, n1-n2));
        jQuery.post("student/finished",{id:id},function (rst) {
            let data='';
            for (let i=0;i<rst.length;i++) {
                let tmp=rst[i];
                data+=`
                <div class="card border-dark mb-3">
                    <div class="card-header">${tmp.question}</div>
                    <div class="card-body text-dark">
                        <h5 class="card-title">您的答案：${tmp.studentAnswer}</h5>
                        <h5 class="card-title">正确答案：${tmp.rightAnswer}</h5>
                    </div>
                    <p class="card-footer">${tmp.status==2?"未批改":(tmp.status==3?"正确":"错误")}</p>
                </div>
                `;
            }
            if (rst.length==0) {
                data=`<h2>没有做过的作业，快去做两个题吧</h2>`;
            }
            jQuery("#exam").html(`
                <a class="nav-link" href="studentExaminationInformation.html?id=${id}">
                    我的考试
                </a>`);
            jQuery("#liUnfinished").html(`<a class="nav-link btn btn-light" href="studentSelectHomework.html?id=${id}")>未完成作业</a>`);
            jQuery("#liFinished").html(`<a class="nav-link btn btn-light" href="studentFinishedHomework.html?id=${id}">已完成作业</a>`);
            jQuery(".homework").html(data);
        });
    })
</script>
</html>
